/***************************************************************************
 * 文件名:ETSService.java<br>
 * 版本: <br>
 * 描述: <br>
 * 版权所有: <br>
 * //////////////////////////////////////////////////////// <br>
 * 创建者: robo<br>
 * 创建日期: 2010-11-15 <br>
 * 修改者: <br>
 * 修改日期: <br>
 * 修改说明: <br>
 **************************************************************************/
package com.sunwayhorizo.health.ets.base.service;

import java.util.Date;
import java.util.List;

import javax.ejb.Local;

import com.sunwayhorizo.health.business.dto.DictionaryDTO;
import com.sunwayhorizo.health.business.dto.ResultsDTO;
import com.sunwayhorizo.health.ets.base.persistent.EtCodingSchemes;
import com.sunwayhorizo.health.ets.base.persistent.EtConceptlists;
import com.sunwayhorizo.health.ets.base.persistent.EtConcepts;
import com.sunwayhorizo.health.ets.base.persistent.EtDescriptions;
import com.sunwayhorizo.health.ets.base.persistent.EtVersions;
import com.sunwayhorizo.health.ets.exceptions.ETSBadParameterException;
import com.sunwayhorizo.health.ets.exceptions.ETSDataException;
import com.sunwayhorizo.health.ets.exceptions.ETSNotFoundException;
import com.sunwayhorizo.health.ets.exceptions.common.ETSDAOException;
import com.sunwayhorizo.health.hl7.common.Hl7Exception;

@Local
public interface ETSService
{

    /**
     * 根据codingschemeEnName得到EtCodingSchemes对象
     * 
     * @param codingschemeEnName
     *            字典英文名称
     * @return
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public EtCodingSchemes findCodingScheme(String codingschemeEnName) throws ETSNotFoundException, ETSBadParameterException, ETSDataException;

    /**
     * 根据codingSchemesId得到版本对象
     * 
     * @param codingschemeId
     * @return
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public EtVersions findCodingSchemeVersion(String codingschemeId) throws ETSNotFoundException, ETSBadParameterException, ETSDataException;

    /**
     * 根据术语主键得到术语对象
     * 
     * @param conceptId
     * @return
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public EtConcepts findConcept(String conceptId) throws ETSNotFoundException, ETSBadParameterException, ETSDataException;

    /**
     * 未实现
     * 
     * @param s
     * @return
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public EtDescriptions findDescription(String s) throws ETSNotFoundException, ETSBadParameterException, ETSDataException;

    /**
     * 未实现
     * 
     * @param s
     * @return
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public EtConceptlists getConceptList(String s) throws ETSNotFoundException, ETSBadParameterException, ETSDataException;

    /**
     * 未实现
     * 
     * @param s
     * @return
     * @throws ETSBadParameterException
     * @throws ETSNotFoundException
     * @throws ETSDataException
     */
    public EtConceptlists getConceptListByID(String s) throws ETSBadParameterException, ETSNotFoundException, ETSDataException;

    /**
     * 未实现
     * 
     * @param s
     * @return
     * @throws ETSDataException
     * @throws ETSBadParameterException
     */
    public List<EtConceptlists> getMatchingConceptLists(String s) throws ETSDataException, ETSBadParameterException;

    /**
     * 未实现
     * 
     * @return
     * @throws ETSDataException
     */
    public List<EtConceptlists> getAllConceptLists() throws ETSDataException;

    /**
     * 根据字典主键得到字典实体
     * 
     * @param codingSchemesId
     * @return
     * @throws ETSNotFoundException
     * @throws ETSDataException
     * @throws ETSBadParameterException
     */
    public EtCodingSchemes getCodingScheme(String codingSchemesId) throws ETSNotFoundException, ETSDataException, ETSBadParameterException;

    /**
     * 根据oid得到EtCodingSchemes对象
     * 
     * @param oid
     * @return
     * @throws ETSNotFoundException
     * @throws ETSDataException
     * @throws ETSBadParameterException
     */
    public EtCodingSchemes getCodingSchemeByOID(String oid) throws ETSNotFoundException, ETSDataException, ETSBadParameterException;

    /**
     * 未实现
     * 
     * @param s
     * @return
     * @throws ETSDataException
     * @throws ETSBadParameterException
     */
    public List<EtCodingSchemes> getMatchingCodingSchemes(String s) throws ETSDataException, ETSBadParameterException;

    /**
     * 得到所有术语字典
     * 
     * @return
     * @throws ETSDataException
     */
    public List<EtCodingSchemes> getAllCodingSchemes() throws ETSDataException;

    /**
     * 未实现
     * 
     * @param i
     * @return
     * @throws ETSDataException
     * @throws ETSBadParameterException
     */
    public List<EtConceptlists> getAllConceptLists(int i) throws ETSDataException, ETSBadParameterException;

    /**
     * 
     * @return
     * @throws ETSDataException
     */
    public String[] getConceptListGroupNames() throws ETSDataException;

    /**
     * 
     * @param s
     * @param s1
     * @return
     * @throws ETSBadParameterException
     * @throws ETSNotFoundException
     * @throws ETSDataException
     */
    public EtConceptlists getConceptList(String s, String s1) throws ETSBadParameterException, ETSNotFoundException, ETSDataException;

    /**
     * 
     * @param s
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<EtConceptlists> getConceptListsByGroupName(String s) throws ETSBadParameterException, ETSDataException;

    /**
     * 
     * @param as
     * @param s
     * @param flag
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> narrowConceptResults(String as[], String s, boolean flag) throws ETSBadParameterException, ETSDataException;

    /**
     * 
     * @param as
     * @param flag
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> findConcepts(String as[], boolean flag) throws ETSBadParameterException, ETSDataException;

    /**
     * 
     * @param as
     * @param i
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> findConcepts(String as[], int i) throws ETSBadParameterException, ETSDataException;

    /**
     * 
     * @param as
     * @param ausagecontext
     * @param i
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> findConcepts(String as[], String codingSchemesEnName, int i) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据字典名称、版本名称查询对应CE列表数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param versionName
     *            版本名称
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> findConcepts(String codingSchemesChName, String codingSchemesEnName, String versionName) throws ETSBadParameterException,
        ETSDataException;

    /**
     * 根据字典名称、版本名称查询对应CE列表数据
     * 
     * @param codingSchemesChName
     * @param codingSchemesEnName
     *            字典名称
     * @param versionName
     *            版本名称
     * @return ResultsDTO
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findConceptsList(String codingSchemesChName, String codingSchemesEnName, String versionName) throws ETSBadParameterException,
        ETSDataException;

    /**
     * 根据字典名称查询对应CE列表数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> findConcepts(String codingSchemesEnName) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据字典名称查询对应CE列表数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param versionName
     *            版本名称
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public List<DictionaryDTO> findConcepts(String codingSchemesEnName, String versionName) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据字典名称查询对应CE列表数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param versionName
     *            版本名称
     * @return ResultsDTO
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findConceptsList(String codingSchemesEnName, String versionName) throws ETSBadParameterException, ETSDataException;

    /**
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param versionName
     *            版本名称
     * @param conceptCode
     *            术语项编码
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    ResultsDTO findDictionaryDtosByCSNameAndVersionNameAndConceptCodeAndModelCode(String codingSchemesEnName, String versionName, String conceptCode,
        String modelCode) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据字典名称查询对应CE列表数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param versionName
     *            版本名称
     * @return ResultsDTO
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findConceptsListAsXml(String codingSchemesEnName, String versionName) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据字典名称、术语CODE查询对应CE数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param conceptCode
     *            术语Code
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public DictionaryDTO findConceptsObj(String codingSchemesEnName, String conceptCode) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据字典名称、术语CODE查询对应CE数据
     * 
     * @param codingSchemesEnName
     *            字典名称
     * @param conceptCode
     *            术语Code
     * @return ResultsDTO
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findConceptsOut(String codingSchemesEnName, String conceptCode) throws ETSBadParameterException, ETSDataException;

    /**
     * 未实现
     * 
     * @param s
     * @param s1
     * @return
     * @throws ETSDataException
     * @throws ETSBadParameterException
     */
    public List<EtConceptlists> getMatchingConceptListsByDescription(String s, String s1) throws ETSDataException, ETSBadParameterException;

    /**
     * 未实现
     * 
     * @param s
     * @param s1
     * @param i
     * @return
     * @throws ETSDataException
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     */
    public boolean isEquivalent(String s, String s1, int i) throws ETSDataException, ETSNotFoundException, ETSBadParameterException;

    /**
     * 未实现
     * 
     * @param s
     * @param i
     * @return
     * @throws ETSDataException
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     */
    public String[] getEquivalentConceptIDs(String s, int i) throws ETSDataException, ETSNotFoundException, ETSBadParameterException;

    /**
     * 未实现
     * 
     * @param s
     * @param s1
     * @param s2
     * @return
     * @throws ETSDataException
     * @throws ETSBadParameterException
     * @throws ETSNotFoundException
     */
    public boolean validateConceptListMembership(String s, String s1, String s2) throws ETSDataException, ETSBadParameterException, ETSNotFoundException;

    /**
     * 未实现
     * 
     * @param s
     * @param s1
     * @param i
     * @param s2
     * @param flag
     * @return
     * @throws ETSDataException
     * @throws ETSNotFoundException
     * @throws ETSBadParameterException
     */
    public boolean isEquivalent(String s, String s1, int i, String s2, boolean flag) throws ETSDataException, ETSNotFoundException,
        ETSBadParameterException;

    public String[] getEquivalentConceptIDs(String s, int i, String s1, boolean flag) throws ETSDataException, ETSNotFoundException,
        ETSBadParameterException;

    public String[] getEquivalentConceptIDs(String s, int i, String s1, boolean flag, String s2) throws ETSDataException, ETSNotFoundException,
        ETSBadParameterException;

    // public LocalConceptDescription[]
    // findLocallyPreferredDescriptionsForConceptIDs(
    // String as[]) throws ETSDataException, ETSBadParameterException;
    //
    // public TerminologyConceptDescription[]
    // findTerminologyPreferredDescriptionsForConceptIDs(
    // String as[]) throws ETSDataException, ETSBadParameterException;

    public List<EtDescriptions> findDescriptionsForConceptIDs(String as[]) throws ETSDataException, ETSBadParameterException;

    public List<DictionaryDTO> findMatchingConceptsByDescriptionTerm(String s) throws ETSDataException, ETSBadParameterException;

    public List<DictionaryDTO> findMatchingConceptsByDescriptionTerm(String s, long l) throws ETSDataException, ETSBadParameterException;

    // public ConceptListMember[] findConceptListMembers(String as[],
    // String as1[], String as2[], int i, boolean flag)
    // throws ETSBadParameterException, ETSDataException;

    public Date getSystemDate() throws ETSDAOException;

    public Date getMaxDate() throws ETSDAOException;

    /**
     * 根据code查询所对庆的所有行政区划
     * 
     * @param code
     *            行政区划code
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findConceptsPlaceList(String code) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据 术语Code、术语名称查询对应CE数据
     * 
     * @param conceptCode
     *            术语Code
     * @param conceptName
     *            术语名称
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    DictionaryDTO findConceptsDTO(String conceptCode, String conceptName) throws ETSBadParameterException, ETSDataException;

    /**
     * 根据 字典名称、术语名称查询对应CE数据
     * 
     * @param codingSchemesEnName
     *            术语Code
     * @param conceptName
     *            术语名称
     * @return
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    DictionaryDTO findConceptsDTOByCodeAndEnName(String codingSchemesEnName, String conceptName) throws ETSBadParameterException, ETSDataException;

    public DictionaryDTO findDictionaryDTOBlobOrClob(String codingschemeEnName, String conceptCode) throws ETSBadParameterException, ETSDataException;

    public ResultsDTO findConceptsListBlobOrClob(String codingSchemesChName, String codingSchemesEnName, String versionName)
        throws ETSBadParameterException, ETSDataException;

    public ResultsDTO findDictionaryDtosByConceptClass(String conceptClass) throws ETSBadParameterException, ETSDataException;
    
    public List<DictionaryDTO> findDictionaryDtosListByConceptClass(String conceptClass) throws Hl7Exception;
    
    public List<DictionaryDTO> findDictionaryDtosListByCond(String codingSchemesEnName,String versionName,String conceptCode,String conceptClass) 
        throws Hl7Exception;
    
    /**
     * 根据字典英文名称（版本名称、术语编码、术语分类可选）进行查询术语项，按照术语分类进行叶子节点的查询
     * @param codingschemeEnName            字典英文名称       
     * @param versionName                   版本名称
     * @param conceptCode                   术语编码
     * @param conceptClass                  术语分类
     * @return                              返回的术语项     
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findLeafDirAll(String codingschemeEnName, String versionName, String conceptCode, String conceptClass)
        throws ETSBadParameterException, ETSDataException;
    
    /**
     * 根据字典英文名称（版本名称、术语编码、术语分类可选）进行查询术语项的编码，按照术语分类进行叶子节点的编码查询
     * @param codingschemeEnName            字典英文名称       
     * @param versionName                   版本名称
     * @param conceptCode                   术语编码
     * @param conceptClass                  术语分类
     * @return                              返回的术语项编码   
     * @throws ETSBadParameterException
     * @throws ETSDataException
     */
    public ResultsDTO findLeafDirCodeAll(String codingschemeEnName, String versionName, String conceptCode, String conceptClass)
        throws ETSBadParameterException, ETSDataException;
    
    public List<String> findLeafDirCode(String codingschemeEnName,String versionName,String conceptCode,String conceptClass) throws Hl7Exception;
}
